home *** CD-ROM | disk | FTP | other *** search
/ Programming an RTS Game with Direct3D / Programming an RTS Game with Direct3D.iso / Examples / Chapter 13 / Example 13.1 / sound.h < prev   
Encoding:
C/C++ Source or Header  |  2006-06-30  |  769 b   |  45 lines

  1. #ifndef _RTS_SOUND_
  2. #define _RTS_SOUND_
  3.  
  4. #include <vector>
  5. #include <d3dx9.h>
  6. #include <dmusici.h>
  7. #include <dsound.h>
  8. #include "debug.h"
  9.  
  10. class SOUND;
  11.  
  12. class SOUNDFILE
  13. {
  14.     friend class SOUND;
  15.     public:
  16.         SOUNDFILE();
  17.         ~SOUNDFILE();
  18.         void Load(WCHAR fileName[], SOUND &sound);
  19.  
  20.     private:
  21.         IDirectMusicSegment8 *m_pSegment;
  22. };
  23.  
  24. class SOUND
  25. {
  26.     friend class SOUNDFILE;
  27.     public:
  28.         SOUND();
  29.         ~SOUND();
  30.         void Init(HWND windowHandle);
  31.         
  32.         void PlaySound(int soundID, bool loop);
  33.         void SetMasterVolume(float volume);
  34.         float GetMasterVolume(){return m_masterVolume;}
  35.  
  36.     private:
  37.         IDirectMusicPerformance8 *m_pPerformance;
  38.         IDirectMusicLoader8 *m_pLoader;
  39.  
  40.         float m_masterVolume;
  41.         std::vector<SOUNDFILE*> m_sounds;
  42. };
  43.  
  44.  
  45. #endif